package com.ruoyi.sso.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.ruoyi.common.config.Global;

/**
 * 作者: @author Harmon <br>
 * 时间: 2017-08-11 08:58<br>
 * 
 * @gitee https://gitee.com/fuyang_lipengjun/platform 描述: ApiUserUtils <br>
 */
@Component
public class ApiUserUtils {

	@Autowired
	private Global ruoYiConfig;
	
	
	// 替换字符串
	public String getCode(String APPID, String REDIRECT_URI, String SCOPE) {
		
		return String.format(ruoYiConfig.getWxGetCode(), APPID, REDIRECT_URI, SCOPE);
	}

	// 替换字符串
	public  String getWebAccess(String CODE) {
		System.out.println(ruoYiConfig.getWxWebAccessTokenhttps());
		return String.format(ruoYiConfig.getWxWebAccessTokenhttps(), ruoYiConfig.getWxAppId(),
				ruoYiConfig.getWxSecret(), CODE);
	}

	// 替换字符串
	public  String getUserMessage(String access_token, String openid) {
		return String.format(ruoYiConfig.getWxUserMessage(), access_token, openid);
	}
}
